#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:do_mysqlclient.py
# author:Jackiex
# datetime:2023/5/15 10:15
# software: PyCharm

'''
     mysqlclient，完全兼容 MySQLdb，同时支持 Python3.x，是 Django ORM的依赖工具，
     如果你想使用原生 SQL 来操作数据库，那么推荐此驱动。
     和MySQLdb的用法完全一样
      pip install mysqlclient
'''

import  MySQLdb
mydb = MySQLdb.connect(
    host='139.9.128.8',
    port=3306,
    db='sct_study',
    user='test',
    passwd='123456',
)

cursor = mydb.cursor()
cursor.execute("SELECT * from student")
res = cursor.fetchall()

for row in res:
    print(row)

cursor.close()

